package com.dhl.mediator.smarthouse;

import com.dhl.mediator.Mediator;

/**
 * @title: Alarm
 * @Author danghailiang
 * @Date: 2022/8/22 10:43
 * @Version 1.0
 */
public class Alarm extends Colleague{

    public Alarm(String name, Mediator mediator) {
        super(name, mediator);
        // 自我注册
        mediator.register(this.name,this);
    }

    @Override
    protected void sendMessage(int stateChange) {
        Mediator mediator = this.getMediator();
        mediator.getMessage(stateChange, this.name);
    }

    /**
     * 发送消息
     * @param stateChange
     */
    public void sndAlarm(int stateChange){
        sendMessage(stateChange);
    }
}
